package com.taxshare.seller.controller;

import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.response.beans.Response;
import com.taxshare.seller.entity.SellerMergeTemplateEntity;
import com.taxshare.seller.entity.SellerRuleTemplateEntity;
import com.taxshare.seller.entity.SellerSplitTemplateEntity;
import com.taxshare.seller.service.SellerMergeTemplateService;
import com.taxshare.seller.service.SellerRuleTemplateService;
import com.taxshare.seller.service.SellerSplitTemplateService;
import com.taxshare.seller.view.dto.SellerMergeTemplateDTO;
import com.taxshare.seller.view.dto.SellerRuleTemplateDTO;
import com.taxshare.seller.view.dto.SellerSplitTemplateDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: SellerInvoiceTemplateController
 * @Description:
 * @author: Hai
 * @date: 2021/7/1 17:00
 */
@Slf4j
@RestController
@RequestMapping("/invoiceTemplate")
@Api(tags="开票规则模板")
public class SellerInvoiceTemplateController {

    @Autowired
    private SellerSplitTemplateService sellerSplitTemplateService;

    @Autowired
    private SellerMergeTemplateService sellerMergeTemplateService;

    @Autowired
    private SellerRuleTemplateService sellerRuleTemplateService;

    @PostMapping("/getSellerSplitTemplateList")
    @ApiOperation(value = "拆分规则模板分页查询", notes = "开票规则模板")
    public Response getSellerSplitTemplateList(@RequestBody PageRequest<SellerSplitTemplateDTO> query) {
        return sellerSplitTemplateService.getSellerSplitTemplateList(query);
    }

    @PostMapping("/addSellerSplitTemplateList")
    @ApiOperation(value = "拆分规则模板新增", notes = "开票规则模板")
    public Response addSellerSplitTemplateList(@RequestBody SellerSplitTemplateEntity entity) {
        return sellerSplitTemplateService.addSellerSplitTemplateList(entity);
    }

    @PostMapping("/updateSellerSplitTemplateList")
    @ApiOperation(value = "拆分规则模板修改", notes = "开票规则模板")
    public Response updateSellerSplitTemplateList(@RequestBody SellerSplitTemplateEntity entity) {
        return sellerSplitTemplateService.updateSellerSplitTemplateList(entity);
    }

    @PostMapping("/delSellerSplitTemplate")
    @ApiOperation(value = "拆分规则模板删除", notes = "开票规则模板")
    public Response delSellerSplitTemplate(@RequestParam String uuid) {
        return sellerSplitTemplateService.delSellerSplitTemplateList(uuid);
    }

    @PostMapping("/getSellerMergeTemplateList")
    @ApiOperation(value = "合并规则模板分页查询", notes = "开票规则模板")
    public Response getSellerMergeTemplateList(@RequestBody PageRequest<SellerMergeTemplateDTO> query) {
        return sellerMergeTemplateService.getSellerMergeTemplateList(query);
    }

    @PostMapping("/addSellerMergeTemplateList")
    @ApiOperation(value = "合并规则模板新增", notes = "开票规则模板")
    public Response addSellerMergeTemplateList(@RequestBody SellerMergeTemplateEntity entity) {
        return sellerMergeTemplateService.addSellerMergeTemplateList(entity);
    }

    @PostMapping("/updateSellerMergeTemplateList")
    @ApiOperation(value = "合并规则模板修改", notes = "开票规则模板")
    public Response updateSellerMergeTemplateList(@RequestBody SellerMergeTemplateEntity entity) {
        return sellerMergeTemplateService.updateSellerMergeTemplateList(entity);
    }

    @PostMapping("/delSellerMergeTemplate")
    @ApiOperation(value = "合并规则模板删除", notes = "开票规则模板")
    public Response delSellerMergeTemplate(@RequestParam String uuid) {
        return sellerMergeTemplateService.delSellerMergeTemplateList(uuid);
    }

    @PostMapping("/getSellerRuleTemplate")
    @ApiOperation(value = "规则模板分页查询", notes = "开票规则模板")
    public Response getSellerRuleTemplate(@RequestBody PageRequest<SellerRuleTemplateDTO> query) {
        return sellerRuleTemplateService.getSellerRuleTemplate(query);
    }

    @PostMapping("/addSellerRuleTemplate")
    @ApiOperation(value = "规则模板新增", notes = "开票规则模板")
    public Response addSellerRuleTemplate(@RequestBody SellerRuleTemplateEntity entity) {
        return sellerRuleTemplateService.addSellerRuleTemplate(entity);
    }

    @PostMapping("/updateSellerRuleTemplate")
    @ApiOperation(value = "规则模板修改", notes = "开票规则模板")
    public Response updateSellerRuleTemplate(@RequestBody SellerRuleTemplateEntity entity) {
        return sellerRuleTemplateService.updateSellerRuleTemplate(entity);
    }

    @PostMapping("/delSellerRuleTemplate")
    @ApiOperation(value = "规则模板删除", notes = "开票规则模板")
    public Response delSellerRuleTemplate(@RequestParam String uuid) {
        return sellerRuleTemplateService.delSellerRuleTemplate(uuid);
    }

}
